//
//  crc.cc
//  Draco
//
//  Created by Liu Dafan on 12-2-23.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#include <inttypes.h>
#include <boost/crc.hpp>
#include "crc.h"

CRC16 boost_crc16( void const *buffer, size_t byte_count)
{
    static boost::crc_16_type computer;
    
    computer.reset();
    computer.process_bytes( buffer, byte_count );
    return computer.checksum();

}

CRC32 boost_crc32( void const *buffer, size_t byte_count)
{
    static  boost::crc_32_type computer;
    
    computer.reset();
    computer.process_bytes( buffer, byte_count );
    return computer.checksum();    
}

CRC64 boost_crc64( void const *buffer, size_t byte_count)
{
    static  boost::crc_optimal<64,0x1021>  computer;
    
    computer.reset();
    computer.process_bytes( buffer, byte_count );
    return computer.checksum();
}